App({
  appData: {
    systemUser:{
      status: '未登录',
      password:'',
      phone:'',
    },
    
    //contextPath: 'http://20a72t1669.iok.la:8082/Map/'
    //contextPath: 'http://localhost:8080/Map/',
    //contextPath: 'http://192.168.0.2:8080/Map/', 
   //contextPath: 'https://fyp001.com/Map/',
    contextPath: 'https://ruxueyou.top',
    //contextPath: 'http://49.234.91.19/Map/',
  },
  onLaunch: function () {
    //通过code获取openid

    //调用API从本地缓存中获取数据
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    wx.login({
      success: function(res) {
        console.info(res)
      }
    })
  },
  getUserInfo:function(cb){
    var that = this;
    if(this.globalData.userInfo){
      typeof cb == "function" && cb(this.globalData.userInfo)
    }else{
      //调用登录接口
      wx.login({
        success: function () {
          wx.getUserInfo({
            success: function (res) {
              that.globalData.userInfo = res.userInfo;
              typeof cb == "function" && cb(that.globalData.userInfo)
            }
          })
        }
      });
    }
  },
  globalData:{
    userInfo:null
  }
})
